﻿using Microsoft.EntityFrameworkCore;

namespace EF测试
{
    public class ARgoContext : DbContext
    {
        public DbSet<Product> Products { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                // 使用绝对路径连接到数据库
                optionsBuilder.UseSqlite("Data Source=d:\\net\\products.db");
            }
        }
    }

    public class Product
    {
        public int Id { get; set; }
        public required string Name { get; set; }
        public decimal Price { get; set; }
    }
}
